#!/bin/bash
# ./run_jar.sh directory xxx.jar '-Dspring.profiles.active=dev'
# $1--目录 $2--jar文件 $3--参数

echo "stop $2"
pid=`ps -ef | grep $2 | grep -v grep | grep -v run_jar.sh | awk '{print $2}'`
if [ -n "$pid" ]
then
    echo "kill $2 $pid"
    kill $pid
fi

sleep 15

echo "start $2"
nohup java $3 -jar "$1/$2" > /dev/null 2>&1 &
